# Contributor: Edd Salkield <edd@salkield.uk>
# Maintainer: Edd Salkield <edd@salkield.uk>
pkgname=fathom
pkgver=1.3.1
pkgrel=5
pkgdesc="Privacy-focused website analytics"
url="https://github.com/usefathom/fathom"
arch="all"
license="MIT"
makedepends="npm go sqlite-dev"
source="https://github.com/usefathom/fathom/archive/v$pkgver/fathom-v$pkgver.tar.gz"

export GOFLAGS="$GOFLAGS -tags=libsqlite3"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	default_prepare
	npm ci
	go mod vendor
}

build() {
	go build -mod=mod -o fathom ./main.go
}

check() {
	make test
}

package() {
	install -Dm755 fathom "$pkgdir/usr/bin/fathom"
}

sha512sums="
077887e753698d347ae3d0c199b085593a9f6bb38a04b7f3ad8df3889e104ceedd0ff92caa3f8cf1abb2adbdc0d6c3fcccc7c7ff711b757926605de6f8481d62  fathom-v1.3.1.tar.gz
"
